	<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="/resource/UserPwoer.tld" prefix="p"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	pageContext.setAttribute("fnId", request.getAttribute("fnId"));
	pageContext.setAttribute("userPwoer", request.getSession().getAttribute("userPwoer"));
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="../images/favicon.ico">
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>
</head>
<body class="gray-bg">
	<nav class="huiNav">
	   <%@include file="project-nav.jsp" %>项目文档
		<!-- <i class="fa fa-home"></i> 首页 <span>&gt;</span>系统管理<span>&gt;</span>项目文档 -->
		<a class="btn btn-info  btn-sm pull-right"
			href="javascript:location.replace(location.href);" title="刷新"><i
			class="fa fa-refresh"></i></a>
	</nav>
	<input type="hidden" id="userId" value="${user.id}">
	<div class="ibox-content">
	<%-- <jsp:include page="proj-manager-son.jsp"></jsp:include> --%>
	<!-- 搜索框部分start -->
		<form class="form-inline" id="serchform">
			<input type="hidden" value="${obj.id}" name="projId" id="projId">
			<%-- <label for="exampleInputName2">角色</label>
			<div class="form-group mr-20">
					<div class="col-sm-4 ">
						<select name="roleId" class="  form-control autoFull"
							style="width: 200px" data-url="${path}/admin/role/showList"
							data-filed="name" data-value="id">
							<option value="">--请选择角色--</option>
						</select>
					</div>
			</div> --%>
			<input type="hidden" value="">
			<br>
			<div class="form-group mr-20">
				<label for="exampleInputName2">文件名称</label>
				<input name="fileName" type="text" class="form-control">
			</div>
		
			<button  onclick="myGrid.serchData()" type="button" class="btn btn-info btn-sm"><i class="fa fa-search " ></i> 搜索</button>
			<button  type="reset" class="btn btn-info btn-sm"><i class="fa fa-refresh " ></i> 重置</button>
		</form>
	<!-- 搜索框部分en -->
	   <div style="position: relative; top: 40px;z-index: 12">
			<button onclick="myGrid.delItems()" type="button" class="btn btn-danger btn-sm"><i class="fa fa-trash" ></i>批量删除</button>
			<button onclick="openAdd()" type="button" class="btn btn-success btn-sm"><i class="fa fa-plus" ></i>  新增</button>
		</div> 
		<div class="row">
			<div class="col-md-10" >
		
			<table id="mgrid" >
				<thead>
					<tr>
						<th data-checkbox="true"  ></th>
						<th data-formatter="MGrid.indexfn" data-align="center"  data-width="30px" >序号</th>
						<th data-field="fileName" >文档名称</th>
						<th data-field="fileSize" >文档大小</th>
						<th data-field="uploadTime" data-formatter="MGrid.getTime" data-sortable="true" >上传时间</th>
						<th data-field="userName" >上传人</th>
						<th data-align="center"  data-width="150px" data-field="id" data-formatter="buidOperate">操作</th>
					</tr>
				</thead>
			</table>
			</div>
			<div class="col-md-2">
				<label>温馨提示</label><br>
				<label>项目完整文档如下</label>	
				<ol>
					<li>商务洽谈记录</li>
					<li>项目可行性分析</li>
					<li>招标书</li>
					<li>邀标书</li>
					<li>报价方案</li> 
					<li>需求文档</li>
					<li>原型资料</li>
					<li>数据库pdm</li>
					<li>项目使用手册</li>
					<li>项目开发说明</li>
					<li>客户提供的资料</li>
				</ol>
			</div>
		</div>
	</div>
	
	<%-- <form class="form-horizontal" id="dataform" action="${path}/admin/projectText/uploadFile" method="post"
		onsubmit="return verify()" >
		<input type="hidden" name="tokenUrl" value="${tokenUrl}"> <input
			type="hidden" name="token" value="${token}">

		<c:if test="${obj ne null }">
			<input type="hidden" name="id" value="${obj.id }">
		</c:if>
		<div class="form-group">
			<label class="col-sm-2 control-label">文档名称</label>
			<div class="col-sm-8">
				<input type="text" name="fileName" id="fileName" value=""
					class="form-control radius" dataType="*1-50">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">查看权限</label>
			<div class="col-sm-8" id="div1">
				<select multiple="multiple" class="form-control select2" size="1" name="roleId" id="s1" >
					<c:forEach items="${projPostList}" var="item">
						<option	
							<c:if test="${projText.roleIds eq item.id }"> selected="selected" </c:if>
							value='${item.id }'>${item.postName}</option>
					</c:forEach>
				</select>
			</div>
			<div class="Validform_checktip"></div>
			<input type="hidden" name="fileUrl" id="fileUrl">
			<input type="hidden" name="fileSize" id="fileSize">
			<input type="hidden" name="roleIds" id="roleIds">
			<input type="hidden" name="projId" value="${obj.id}">
			
		</div>
		<div class="form-group">
		<label class="col-sm-2 control-label">文件上传</label>
			<div class="col-sm-8">
				<input onclick="MTools.chooesFile('#fileText2')"
					class="input-text upload-url radius form-control" type="text" id="showFileName2"
					readonly style="width: 30%;display: inline;"  onchange="getFile()" onfocus="cleanFileUrl()"> 
					<a onclick="MTools.chooesFile('#fileText2')" class="btn btn-primary radius"> 
					<i   class="fa fa-cloud-upload"></i> 浏览文件 </a> 
					<input type="button" class='btn btn-primary radius'onclick="MTools.upFile('#submitBtn2')" value="上传"> 
			</div>
		</div>

		
		<div class="form-group ">
			<div class="col-sm-12 text-center">
				<!-- <a href="javascript:;" onclick="myForm.submit()"
					class="btn btn-success radius">保存</a> -->
					<input type="submit" value="上传" class="btn btn-success radius">
					&nbsp;&nbsp;&nbsp;&nbsp;
				<button onclick="MTools.closeForm()" class="btn btn-danger radius"
					type="button">取消</button>
			</div>
		</div>
	</form>
	<iframe src="" name="blankFrame" id="blankFrame"
				style="height: 100px; width: 100px; display: none;"> </iframe>
	<form class="form form-horizontal" method="post" style="display: none;"
		enctype="multipart/form-data" target="blankFrame" 
	action="${path }/resource/plugin/kindeditor/upload_json.jsp?fileType=file&hiddenId=fileUrl">
		<input id="fileText2" type="file" multiple name="file-1"onchange="MTools.selectFile('#showFileName2','#fileText2','')" /> 
		<input type="submit" id="submitBtn2"/>
	</form> --%>
	
	<a href="${path}/admin/"></a>
	<script type="text/javascript">
	
	
	
	/* function getFile() {
		alert(1111);
		//var file = document.getElementById("showFileName2").files; 
		//$("#fileSize").val(file[0].size);
	} */
	/* function getFileType(){
		var file = document.getElementById("file").files; 
		var index=.type.indexOf("/");
		var type=file[0].type.substring(0,index);
		$("#dir").val(type);
		$("#fileSize").val(file[0].size);
	} */
	var myGrid;
		$(function(){
			var delUrl="";
				delUrl="${path}/admin/projectText/del";
			 myGrid=MGrid.initGrid({
				 url:"${path}/admin/projectText/showList", 
				 delUrl:delUrl
			 });
		});
		
		function buidOperate(value, row, index){
			var html='';
			html+='<a class="btn btn-default btn-sm mr-5" href="'+row.fileUrl+'"  title="下载"><i class="glyphicon glyphicon-download"></i></a>';
			if($("#userId").val()==row.userId){
			html+='<button class="btn btn-default btn-sm mr-5" onClick="openEdit('+value+')" title="""><i class="fa fa-edit"></i></buttoun>';
			html+='<button class="btn btn-default btn-sm mr-5" onClick="myGrid.delItem('+value+')" title="删除"><i class="fa fa-lg fa-trash-o"></i></buttoun>';
			}
			return html; 
		}
		 //打开添加界面
		function openAdd() {
			layer.open({
				type : 2,
				title : "添加项目文档",
				area : [ MUI.SIZE_L, '400px' ],
				content : [ '${path}/admin/projectText/editForm?projId='+$("#projId").val()]
			}); 
		} 
		//打开编辑界面
	 	function openEdit(id) {
			layer.open({
				type : 2,
				title : "编辑项目文档",
				area : [ MUI.SIZE_L, '400px' ],
				maxmin : true,
				content : [ '${path}/admin/projectText/editForm?id=' + id]
			});
		} 
		
		/* function download(id){
			alert(11);
			
				
			});

			MTools.redirect("${path}/admin/projectText/download?id="+id);
		} */
		
		//重置密码
		/* function resetPass(id){
			layer.msg('重置后密码为【123】确定重置密码吗？', {
				  time: 0 ,
				  icon:3,
				  btn: ['确定', '取消'],
				  yes: function(index){
				     layer.close(index);
				    //*把密码设置为123
					$.AjaxProxy(
							{a : false,
							 c : false,
							 p:{id:id}}).invoke("${path}/admin/resetPassword",function(loj){
						if(loj.attr("result").status=='ok'){
							layer.msg("密码重置成功",{icon:1});
						}
					});
					
				  }
				});
			
		} */ 
	</script>
</body>
</html>